<%@ page import="com.gpay.erp.core.system.bean.SysUser" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<script src="<%=request.getContextPath() %>/resources/js/storage/storageManage.js"
        type="text/javascript"></script>
<script src="<%=request.getContextPath() %>/resources/js/storage/bePutInStorageDocAdd.js"
        type="text/javascript"></script>
<script>
    $(function () {
        //TODO 已入库量
        $('#storageNumber').numberbox({
            precision: 6,
            formatter: function (value) {
                value = Math.round(parseFloat(value) * Math.pow(10, 6)) / Math.pow(10, 6);
                return formatWeight(value);
            }
        })
        //TODO 本次已入库量
        $('#storageWeight').numberbox({
            precision: 6,
            formatter: function (value) {
                value = Math.round(parseFloat(value) * Math.pow(10, 6)) / Math.pow(10, 6);
                return formatWeight(value);
            }
        })
        //TODO storagePage
        $('#storagePage').numberbox({
        })
        initComboDataGrid("/storage/warehouse.html", $('#warehouseCode'), houseWaresOptions());
        initTopStorageFileForm();
        initDataGridNoPager($('#subItem'), getStorageFileSubOptions());
        add();
        $('#saveBePutStorageFileFunction').click(function () {
            var isValid = showValidteMessage(validateStorageFileTopSubs()) && showValidteMessage(validateBottomSubs(prepareStorageFileSubmitPostData().storageSubs));
            if (isValid) {
                postAjax("/storage/saveStorageSub.html", JSON.stringify(prepareStorageFileSubmitRealPostData()),
                        refreshStorageFileList, {async: false});
            } else {
                return isValid;
            }
        })
    });

    $('#addSub').click(function(){
        add();
    })
    $('#deleteSub').click(function(){
        del();
    })

</script>
<%--入库单号、入库类型、入库日期、经办人、经办部门、入库码单号、入库完成（是/否）、仓库代码、仓库名称、供应商、品种名称
、规格、牌号、产地、技术标准、质量等级、已入库量、本次入库量、备注--%>
<var hidden="hidden" id="contractSubId">${contractSubId}</var>
<var hidden="hidden" id="contractSubCode"></var>
<var hidden="hidden" id="resourceNumber"></var>
<var hidden="hidden" id="userId"><%=((SysUser)session.getAttribute("loginUser")).getId()%></var>

<div class="easyui-layout" data-options="fit : true,border : false">
    <div data-options="region:'north',title:'入库单',border : false" style="height: 180px; overflow: hidden;">
        <form id="searchForm-small">
            <div class="mLeft60">
                <div class="mTop10 line-handsome">
                    <div class="fLeft label-handsome ">
                        <label>入库单号:</label>
                        <input id="storageCode" name="storageCode" readonly>
                        </input>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>入库类型:</label>
                        <input id="storageType" name="storageType" class="easyui-input" readonly/>
                    </div>
                    <div class="fLeft label-handsome" id="memberNoDiv">
                        <label>入库日期:</label>
                        <input id="storageDate" type="text" name="storageDate" class="easyui-datebox"
                               required="required" style="width:90px"/>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>经办人:</label>
                        <input id="operator" name="operator" class="easyui-input" readonly
                               value="<%=((SysUser)session.getAttribute("loginUser")).getUserName()%>" />
                    </div>
                </div>
                <div class="mTop10 line-handsome">
                    <div class="fLeft label-handsome ">
                        <label>经办部门:</label>
                        <%
                            String deptName = ((SysUser) session.getAttribute("loginUser")).getDeptName();
                            if (deptName == null) {
                                deptName = "";
                            }
                        %>
                        <input id="signDept" name="deptment" readonly
                               value="<%=deptName%>"/>
                    </div>
                    <div class="fLeft label-handsome">
                        <label>入库码单号:</label>
                        <input id="storageMdCode" name="storageMdCode"/>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>入库完成:</label>
                        <%--//todo --%>
                        <input id="flagFinish" name="flagFinish" type="checkbox"/>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label class="redSharp">*仓库代码:</label>
                        <select id="warehouseCode" name="warehouseCode" style="width:90px" />
                    </div>
                </div>
                <div class="mTop10 line-handsome">
                    <div class="fLeft label-handsome ">
                        <label>仓库名称:</label>
                        <input id="warehouseName" type="text" name="warehouseName" readonly/>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>供应商:</label>
                        <input id="providerName" name="providerName" class="easyui-input" readonly/>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>品种名称:</label>
                        <input id="goodsName" name="goodsName" class="easyui-input" readonly/>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>规格:</label>
                        <input id="cpspecification" name="cpspecification" class="easyui-input" readonly/>
                    </div>
                </div>
                <div class="mTop10 line-handsome">
                    <div class="fLeft label-handsome ">
                        <label>牌号:</label>
                        <input id="marks" name="marks" class="easyui-input" readonly/>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>产地:</label>
                        <input id="cdName" name="cdName" class="easyui-input" readonly/>
                    </div>

                    <div class="fLeft label-handsome ">
                        <label>技术标准:</label>
                        <input id="standards" name="standards" class="easyui-input" readonly/>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>质量等级:</label>
                        <input id="qualityGrade" name="qualityGrade" class="easyui-input" readonly/>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>已入库量:</label>
                        <input id="storageNumber" name="storageNumber" class="easyui-input" readonly/>
                    </div>
                    <div class="fLeft label-handsome" style="display: none">
                        <label>入库件数:</label>
                        <input id="storagePage" name="storagePage" class="easyui-input" readonly/>
                    </div>
                </div>
                <div class="mTop10 line-handsome">
                    <div class="fLeft label-handsome ">
                        <label>本次入库量:</label>
                        <input id="storageWeight" name="storageWeight" class="easyui-input" readonly/>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>备注:</label>
                        <input id="remark" name="remark" class="easyui-input"/>
                    </div>
                    <div hidden="hidden" id="userIdDiv">
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div data-options="region:'center',border : false,title:'采购入库明细列表'">
        <table id="subItem"></table>
    </div>
</div>